package com.zhiliao.chain.demo2;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zouxf Department:3cs
 * @create Date 2023/6/13 11:14
 * @description
 * @lastModifiedBy
 * @lastModifiedDate(yyyy/MM/dd)
 * @see
 */
public class CheckModelTypeHandlerChain implements RecHandlerChain<String, BaseResultInfo<Boolean>> {

    private List<CheckModelTypeHandler> checkModelTypeHandlers;

    public CheckModelTypeHandlerChain() {
        checkModelTypeHandlers = new ArrayList<>();
        checkModelTypeHandlers.add(new AaHandler());
        checkModelTypeHandlers.add(new BbHandler());

    }

    @Override
    public BaseResultInfo<Boolean> handleRequest(String checkRecModelReq) {
        for (CheckModelTypeHandler checkModelTypeHandler : checkModelTypeHandlers) {
            BaseResultInfo<Boolean> resultInfo = checkModelTypeHandler.handleRequest(checkRecModelReq, this);
            if (null != resultInfo) {
                return resultInfo;
            }
        }
        return null;
    }
}






























